package cn.edu.shengda;
interface ShapeArea{
    public abstract double getArea();
    public abstract double getPerimeter();
}
class Circle implements ShapeArea{
    double radius;
    Circle(double r){
        radius=r;
    }
    public double getArea() {
        return 3.14*radius*radius;
    }
    public double getPerimeter(){
        return 2*3.14*radius;
    }
    public String toString() {
        return "圆半径="+radius+",周长="+getPerimeter()+",面积="+getArea();
    }
}
class Rectangle implements ShapeArea{
    double width;
    double height;
    Rectangle(double w,double h){
        width=w;
        height=h;
    }
    public double getArea() {
        return width*height;
    }
    public double getPerimeter(){
        return 2*(width+height);
    }
    public String toString() {
        return "矩形长="+height+",宽="+width+",周长="+getPerimeter()+",面积="+getArea();
    }
}

public class Test {
   public static void main(String args[]){
        Circle c=new Circle(1.0);
        System.out.println(c.toString());
        Rectangle a=new Rectangle(3,4);
        System.out.println(a.toString());
    } 
}